<template>
  <div class="case-detail">
    <div class="left">
      <div class="item">昵称：{{ info.name }}</div>
      <div class="item">日期：</div>
      <!-- <div class="item">提交案例：</div> -->
    </div>

    <div class="right">
      <one-round-of-judging @submit="submit" v-if="info.type === 'one'" :info="info" />
      <second-round-of-judging @submit="submit" v-else :info="info" />
    </div>
  </div>
</template>

<script>
import oneRoundOfJudging from './oneRoundOfJudging.vue'
import secondRoundOfJudging from './secondRoundOfJudging.vue'
import { csexamine, csScore } from '@/api/skinDisease/case/caseApis.js'

export default {
  data() {
    return {
      info: {}
    }
  },
  methods: {
    submit(data) {
      if (this.info.type === 'one') {
        csexamine({
          ...data,
          id: Number(this.info.id),
          examineUser: Number(this.info.examineUser)
        }).then(() => {
          this.$message.success('操作成功')
        })
      }

      if (this.info.type === 'two') {
        csScore({
          ...data,
          id: Number(this.info.id)
        }).then(() => {
          this.$message.success('操作成功')
        })
      }
    }
  },
  created() {
    // const {type, name, examineStatus, comments } = this.$route.query
    const data = this.$route.query || {}
    this.info = data
  },

  components: {
    oneRoundOfJudging,
    secondRoundOfJudging
  }
}
</script>

<style scoped>
.case-detail {
  display: flex;
  justify-content: space-between;
}

.left {
  flex: 0.5;
}

.right {
  flex: 0.5;
}

.case-detail .item {
  min-height: 40px;
}
</style>
